<div>
  <div><label class="control-label"><img src="/images/badge16x16K.gif" width="16" height="16" alt="Kongregate logo"> Sync saved data with other devices <span class="envalert">(beta)</span></label></div>
  <div ng-if="isGuest()"><a href="javascript:" ng-click="api.showSignInBox()">Sign in to Kongregate to save your game to Swarm Simulator's servers.</a></div>
  <div ng-if="!isGuest()">
    <p>Hi {{api.getUsername()}}! Save your game to PlayFab using your Kongregate account.</p>
    <div><label><input type="checkbox" ng-init="form.autopush=options.autopush()" ng-model="form.autopush" ng-change="options.autopush(form.autopush)" class="">Auto-export every 15 minutes and before closing</label></div>
    <div><button class="btn btn-primary" ng-class="{disabled:cooldown.byName.push}" ng-click="push()">Export online saved data</button></div>
    <div><button class="btn btn-default" ng-class="{disabled:cooldown.byName.fetch}" ng-click="fetch()">Check for new online saved data</button></div>
    <div ng-if="remoteSave()">
      <div><button class="btn btn-primary" ng-click="pull()">Import online saved data (replaces your current game)</button></div>
      <div><button class="btn btn-default" ng-class="{disabled:cooldown.byName.clear}" ng-click="clear()">Delete online saved data</button></div>
      <p>Last exported: {{remoteSave().length|number}} chars {{remoteDate()|momentFromNow}}.
        <span ng-if="getAutopushError()">Will not auto-export online<span
          ng-if="getAutopushError()=='nochanges'"> because nothing's changed since the last export</span><span
          ng-if="getAutopushError()=='newgame'"> because this is a new game</span><span
          ng-if="getAutopushError()=='remotenewer'"> because the online save is newer than the one you're playing</span>.</span>
      </p>
    </div>
    <p ng-if="policyError" class="text-danger">{{policyError}}</p>
    <div ng-if="!isBrowserSupported()">
      <p class="text-danger">Looks like your web browser won't work with Kongregate sync: <code>FormData</code>/<code>Blob</code> support not found. <a target="_blank" href="http://browsehappy.com">You should upgrade your browser.</a></p>
    </div>
  </div>
</div>
